package com.chinaway.mobile.http.util;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 远程调用工具
 *
 * @author Harry.min
 * @version 2013年11月22日
 *
 */
public class ServiceUtils {
	protected final static Log log = LogFactory.getLog(ServiceUtils.class);
	/**
	 * 
	 * @param methodName:方法名
	 * @param params：方法的参数
	 * @return ApiResult对象为发出url请求后返回json数据，转变而来
	 * 
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static Object call(String url,String key,String method,Map params) {
		ApiResult apiResult =null;
		try {
			 apiResult = ApiUtil.getResult(url, method, key, params);
		} catch (Exception e) {
			log.info("mobileserver 手机余额网络请求失败！");
		}
		log.info("手机余额更新结果："+apiResult);
		return apiResult;
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static Object call(String methodName, Map params) {
		ApiResult apiResult =null;
		try {
			 apiResult = ApiUtil.getResult(methodName, params);
		} catch (Exception e) {
			log.info("网络请求失败！methodName="+methodName);
		}
		return apiResult;
	}
	
	
}
